local huazuojiazhou = fk.CreateSkill{
    name = "ym2__huazuojiazhou",
}
Fk:loadTranslationTable{
    ["ym2__huazuojiazhou"] = "日轮啊，化作甲胄",
    [":ym2__huazuojiazhou"] = "若你手牌花色数与体力值相同，你可依次执行前X项并视为使用或打出一张基本牌：1.获得1点护甲；2.弃置两张牌；3.下一次造成伤害改为3（X为当前体力值）。",
    ["#ym2__huazuojiazhou-discard"] = "日轮啊，化作甲胄：弃置两张牌",
    ["@@ym2__huazuojiazhou"] = "下次伤害值为3",

    ["$ym2__huazuojiazhou1"] = "瞠目に値する。素晴らしいな、我が敵よ！",
    ["$ym2__huazuojiazhou2"] = "神眼を持って応じよう。貴様を見抜き、そして射貫く！",
}
huazuojiazhou:addEffect("viewas",{
    pattern = ".|.|.|.|.|basic",
    interaction = function(self, player)
        local all_names = Fk:getAllCardNames("b")
        local names = player:getViewAsCardNames(huazuojiazhou.name, all_names)
        return UI.CardNameBox { choices = names, all_choices = all_names, }
    end,
    view_as = function(self, player, cards)
        if not self.interaction.data then return end
        local card = Fk:cloneCard(self.interaction.data)
        card.skillName = huazuojiazhou.name
        return card
    end,
    before_use = function (self, player, use)
        local room = player.room
        local num = player.hp
        if num > 0 then
            room:changeShield(player,1)
        end
        if num > 1 then
            local ids = table.filter(player:getCardIds("he"), function(id)
                return not player:prohibitDiscard(id)
            end)
            local cards = ids
            if #ids > 2 then
                cards = room:askToDiscard(player, {
                    min_num = 2,
                    max_num = 2,
                    include_equip = true,
                    skill_name = huazuojiazhou.name,
                    cancelable = false,
                    prompt = "#ym2__huazuojiazhou-discard",
                    skip = true,
                })
            end
            if #cards > 0 then
                room:throwCard(cards, huazuojiazhou.name, player, player)
            end
        end
        if num > 2 then
            room:setPlayerMark(player,"@@ym2__huazuojiazhou",1)
        end
    end,
    enabled_at_play = function(self, player)
        local suits = {}
        table.forEach(player:getCardIds("h"), function (id)
            if not table.contains(suits, Fk:getCardById(id).suit) then
                table.insertIfNeed(suits, Fk:getCardById(id).suit)
            end
        end)
        return #suits == player.hp and player.hp > 0
    end,
    enabled_at_response = function(self, player, response)
        local suits = {}
        table.forEach(player:getCardIds("h"), function (id)
            if not table.contains(suits, Fk:getCardById(id).suit) then
                table.insertIfNeed(suits, Fk:getCardById(id).suit)
            end
        end)
        return #suits == player.hp and player.hp > 0
    end,
})
huazuojiazhou:addEffect(fk.DamageCaused, {
    mute = true,
    is_delay_effect = true,
    can_trigger = function(self, event, target, player, data)
        return target == player and player:getMark("@@ym2__huazuojiazhou") ~= 0
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        data:changeDamage(3-data.damage)
        room:setPlayerMark(player, "@@ym2__huazuojiazhou", 0)
    end,
})
return huazuojiazhou